package com.freestyle.seatabusiness.account.config;


import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.sql.DataSource;

/**
 * Created by rocklee on 2021/12/31 11:52
 */
@ConditionalOnBean({DataSource.class})
@ConditionalOnExpression("${seata.enable:true} && ${seata.enableAutoDataSourceProxy:true} && ${seata.enable-auto-data-source-proxy:true}")
@Configuration
public class SeataConfig {
  @Bean
  public String testT(){
    return "A";
  }
 /* @Bean
  public DataSourceProxy dataSourceProxy(HikariDataSource dataSource) {
    return new DataSourceProxy(dataSource);
  }

  @Bean
  public DataSourceTransactionManager transactionManager(DataSourceProxy dataSourceProxy) {
    return new DataSourceTransactionManager(dataSourceProxy);
  }
  @Bean
  public SqlSessionFactory sqlSessionFactory(DataSourceProxy dataSource) throws Exception {
    SqlSessionFactoryBean factoryBean = new SqlSessionFactoryBean();
    factoryBean.setDataSource(dataSource);

    return factoryBean.getObject();
  }*/
}
